//登录判断
let login_fn = async (ctx,next)=>{
    let username = ctx.request.body.username || '';
    let password = ctx.request.body.password || '';
    if(username === 'admin' && password === '123'){
        ctx.response.redirect('/login/success');
    }
    else{
        ctx.response.redirect('/login/error');
    }
}

let login_success_fn = async (ctx,next)=>{
    ctx.response.body ='登录成功，今天要热死啦!'
}

let login_error_fn = async (ctx,next)=>{
    ctx.response.body = '账号或密码错误，请重试!'
}

//暴露出去
module.exports = {
    '/login/login':['post',login_fn],
    '/login/success':['get',login_success_fn],
    '/login/error':['get',login_error_fn]
}